<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>


    <script>

        // Number()
        // 布尔值转数字     true -> 1      false -> 0
        // 字符串转数字
        //     纯数字字符串   正常转为数字
        //     非纯数字字符串   NaN
        // null转数字      0
        // undefined转数字    NaN



        // NaN: not a number   非数字的集合



        var a = null;
        var b = Number(a);
        console.log(b);


        var m = '2';
        var n = Number(m);
        console.log(n);   // 2


        var m = 'hi123';
        var n = Number(m);
        console.log(n);   // NaN


        console.log(typeof n);


        var m;
        var n = Number(m);
        console.log(n);   // NaN
    </script>

</body>

</html>